<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * CodeIgniter
 *
 * An open source application development framework for PHP 5.1.6 or newer
 *
 * @package		CodeIgniter
 * @author		ExpressionEngine Dev Team
 * @copyright	Copyright (c) 2008 - 2011, EllisLab, Inc.
 * @license		http://codeigniter.com/user_guide/license.html
 * @link		http://codeigniter.com
 * @since		Version 1.0
 * @filesource
 */

// ------------------------------------------------------------------------

/**
 * CodeIgniter Application Controller Class
 *
 * This class object is the super class that every library in
 * CodeIgniter will be assigned to.
 *
 * @package		CodeIgniter
 * @subpackage	Libraries
 * @category	Libraries
 * @author		ExpressionEngine Dev Team
 * @link		http://codeigniter.com/user_guide/general/controllers.html
 */
class CI_Controller {

	private static $instance;
        
        public  $data = '';//用户显示模板数据

        /**
	 * Constructor
	 */
	public function __construct()
	{
		self::$instance =& $this;
		
		// Assign all the class objects that were instantiated by the
		// bootstrap file (CodeIgniter.php) to local class variables
		// so that CI can run as one big super object.
		foreach (is_loaded() as $var => $class)
		{
			$this->$var =& load_class($class);
		}

		$this->load =& load_class('Loader', 'core');

		$this->load->initialize();
		
		log_message('debug', "Controller Class Initialized");
	}

	public static function &get_instance()
	{
		return self::$instance;
	}
        
        
        /**
         * 用于获取显示页面
         * @author flyten
         * @param type $class
         * @param type $method
         * @return type 
         */
        public function displayIndex(){
          $this->getShowFile();
          $this->load->view('layout.php', $data);
        }
        
        
        /**
         * 用户显示后台模板
         * @author flyten
         * @param type $class
         * @param type $method 
         */
        public  function displayAdmin(){
           $this->getShowFile();
           $this->data['admin_menu'] = $this->config->item('admin_menu');//获取后台导航
           $this->load->view( 'admin/layout', $this->data );
        }
        
        
        /**
         * 获取显示的文件
         * @author flyten
         */
        private function getShowFile(){
           $RTR = &load_class('Router');
           $class = strtolower( $RTR->class );//获取类名,全部为小写
           $method = strtolower( $RTR->method );//获取方法名，全部为小写
           $this->data['showfile'] = $class.'_'.$method.'.php';
        }

        
}
// END Controller class

/* End of file Controller.php */
/* Location: ./system/core/Controller.php */